#include <linux/miscdevice.h> //struct miscdevice
#include <linux/fs.h>         //struct file_operations

#define KDA_MINOR 44

static int kda_open(struct inode *inode, struct file *file)
{
    printk("%s, %d\n", __FUNCTION__, __LINE__);;
    return 0;
}

static struct file_operations kda_fops = {
    .owner = THIS_MODULE,
    .open  = kda_open,    
};

static struct miscdevice kda_dev = {
    KDA_MINOR,
    "kda",
    &kda_fops
};

static int __init hello_init(void)
{
    int err;

    printk("<1>Hello world 1.\n");

    err = misc_register(&kda_dev);
    if (err) {
        printk("envctrl: Unable to get misc minor %d\n",
               kda_dev.minor);
    }


    return 0;
}

static void __exit hello_exit(void)
{
    printk(KERN_ALERT "Goodbye world 1.\n");
    misc_deregister(&kda_dev);
}

module_init(hello_init);
module_exit(hello_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("zengxiaolong ");
MODULE_DESCRIPTION("A sample driver");
MODULE_SUPPORTED_DEVICE("testdevice");
